/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Heinz Hernandez
 */
@Entity
@Table(name = "person")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Person.findAll", query = "SELECT p FROM Person p"),
    @NamedQuery(name = "Person.findByPerType", query = "SELECT p FROM Person p WHERE p.perType = :perType"),
@NamedQuery(name = "Person.findPerByTypeAndNameLike", query = "SELECT p FROM Person p WHERE p.perType = :perType AND lower(p.perName) like :perName"),
    @NamedQuery(name = "Person.findByPerId", query = "SELECT p FROM Person p WHERE p.perId = :perId"),
    @NamedQuery(name = "Person.findByPerName", query = "SELECT p FROM Person p WHERE p.perName = :perName"),
    @NamedQuery(name = "Person.findByPerLastName", query = "SELECT p FROM Person p WHERE p.perLastName = :perLastName"),
    @NamedQuery(name = "Person.findByPerSsn", query = "SELECT p FROM Person p WHERE p.perSsn = :perSsn"),
    @NamedQuery(name = "Person.findByPerBirthDate", query = "SELECT p FROM Person p WHERE p.perBirthDate = :perBirthDate"),
    @NamedQuery(name = "Person.findByPerBirthPlace", query = "SELECT p FROM Person p WHERE p.perBirthPlace = :perBirthPlace"),
    @NamedQuery(name = "Person.findByPerFocus", query = "SELECT p FROM Person p WHERE p.perFocus = :perFocus"),
    @NamedQuery(name = "Person.findByPerSpeciality", query = "SELECT p FROM Person p WHERE p.perSpeciality = :perSpeciality"),
    @NamedQuery(name = "Person.findByPerSalary", query = "SELECT p FROM Person p WHERE p.perSalary = :perSalary"),
    @NamedQuery(name = "Person.findByPerGraduateat", query = "SELECT p FROM Person p WHERE p.perGraduateat = :perGraduateat"),
    @NamedQuery(name = "Person.findByPerType", query = "SELECT p FROM Person p WHERE p.perType = :perType")})
public class Person implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "PER_ID")
    private Long perId;
    @Basic(optional = false)
    @Column(name = "PER_NAME")
    private String perName;
    @Basic(optional = false)
    @Column(name = "PER_LAST_NAME")
    private String perLastName;
    @Basic(optional = false)
    @Column(name = "PER_SSN")
    private String perSsn;
    @Basic(optional = false)
    @Column(name = "PER_BIRTH_DATE")
    @Temporal(TemporalType.DATE)
    private Date perBirthDate;
    @Basic(optional = false)
    @Column(name = "PER_BIRTH_PLACE")
    private String perBirthPlace;
    @Basic(optional = false)
    @Column(name = "PER_FOCUS")
    private String perFocus;
    @Basic(optional = false)
    @Column(name = "PER_SPECIALITY")
    private String perSpeciality;
    @Basic(optional = false)
    @Column(name = "PER_SALARY")
    private int perSalary;
    @Basic(optional = false)
    @Column(name = "PER_GRADUATEAT")
    private String perGraduateat;
    @Basic(optional = false)
    @Column(name = "PER_TYPE")
    private String perType;
    @OneToMany(mappedBy = "perIdown")
    private List<Pet> petList;
    @OneToMany(mappedBy = "perId")
    private List<Pet> petList1;
    @OneToMany(mappedBy = "perId")
    private List<Appointment> appointmentList;

    public Person() {
    }

    public Person(Long perId) {
        this.perId = perId;
    }

    public Person(Long perId, String perName, String perLastName, String perSsn, Date perBirthDate, String perBirthPlace, String perFocus, String perSpeciality, int perSalary, String perGraduateat, String perType) {
        this.perId = perId;
        this.perName = perName;
        this.perLastName = perLastName;
        this.perSsn = perSsn;
        this.perBirthDate = perBirthDate;
        this.perBirthPlace = perBirthPlace;
        this.perFocus = perFocus;
        this.perSpeciality = perSpeciality;
        this.perSalary = perSalary;
        this.perGraduateat = perGraduateat;
        this.perType = perType;
    }

    public Long getPerId() {
        return perId;
    }

    public void setPerId(Long perId) {
        this.perId = perId;
    }

    public String getPerName() {
        return perName;
    }

    public void setPerName(String perName) {
        this.perName = perName;
    }

    public String getPerLastName() {
        return perLastName;
    }

    public void setPerLastName(String perLastName) {
        this.perLastName = perLastName;
    }

    public String getPerSsn() {
        return perSsn;
    }

    public void setPerSsn(String perSsn) {
        this.perSsn = perSsn;
    }

    public Date getPerBirthDate() {
        return perBirthDate;
    }

    public void setPerBirthDate(Date perBirthDate) {
        this.perBirthDate = perBirthDate;
    }

    public String getPerBirthPlace() {
        return perBirthPlace;
    }

    public void setPerBirthPlace(String perBirthPlace) {
        this.perBirthPlace = perBirthPlace;
    }

    public String getPerFocus() {
        return perFocus;
    }

    public void setPerFocus(String perFocus) {
        this.perFocus = perFocus;
    }

    public String getPerSpeciality() {
        return perSpeciality;
    }

    public void setPerSpeciality(String perSpeciality) {
        this.perSpeciality = perSpeciality;
    }

    public int getPerSalary() {
        return perSalary;
    }

    public void setPerSalary(int perSalary) {
        this.perSalary = perSalary;
    }

    public String getPerGraduateat() {
        return perGraduateat;
    }

    public void setPerGraduateat(String perGraduateat) {
        this.perGraduateat = perGraduateat;
    }

    public String getPerType() {
        return perType;
    }

    public void setPerType(String perType) {
        this.perType = perType;
    }

    @XmlTransient
    public List<Pet> getPetList() {
        return petList;
    }

    public void setPetList(List<Pet> petList) {
        this.petList = petList;
    }

    @XmlTransient
    public List<Pet> getPetList1() {
        return petList1;
    }

    public void setPetList1(List<Pet> petList1) {
        this.petList1 = petList1;
    }

    @XmlTransient
    public List<Appointment> getAppointmentList() {
        return appointmentList;
    }

    public void setAppointmentList(List<Appointment> appointmentList) {
        this.appointmentList = appointmentList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (perId != null ? perId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Person)) {
            return false;
        }
        Person other = (Person) object;
        if ((this.perId == null && other.perId != null) || (this.perId != null && !this.perId.equals(other.perId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Person[ perId=" + perId + " ]";
    }
    
}
